<extend name="Public/main" />

<block name="style">
	<script type="text/javascript">
		var catid = "12";
	</script>
	<style type="text/css">
		.col-auto {
			overflow: hidden;
			_zoom: 1;
			_float: left;
			border: 1px solid #c2d1d8;
		}
		.col-right {
			float: right;
			width: 210px;
			overflow: hidden;
			margin-left: 6px;
			border: 1px solid #c2d1d8;
		}

		body fieldset {
			border: 1px solid #D8D8D8;
			padding: 10px;
			background-color: #FFF;
		}
		body fieldset legend {
			background-color: #F9F9F9;
			border: 1px solid #D8D8D8;
			font-weight: 700;
			padding: 3px 8px;
		}
		.content_attr {
			border: 1px solid #CCC;
			padding: 5px 8px;
			background: #FFC;
			margin-top: 6px
		}
		.list-dot{ padding-bottom:10px}
		.list-dot li,.list-dot-othors li{padding:5px 0; border-bottom:1px dotted #c6dde0; font-family:"宋体"; color:#bbb; position:relative;_height:22px}
		.list-dot li span,.list-dot-othors li span{color:#004499}
		.list-dot li a.close span,.list-dot-othors li a.close span{display:none}
		.list-dot li a.close,.list-dot-othors li a.close{ background: url("__STATIC__/images/cross.png") no-repeat left 3px; display:block; width:16px; height:16px;position: absolute;outline:none;right:5px; bottom:5px}
		.list-dot li a.close:hover,.list-dot-othors li a.close:hover{background-position: left -46px}
		.list-dot-othors li{float:left;width:24%;overflow:hidden;}
	</style>
</block>

<block name="body">
	<div class="wrap J_check_wrap">
		<div class="nav">
			<ul class="cc">
				<li ><a href="{:U('Recipients/index')}">待支助人列表</a></li>
				<li class="current"><a target="_self" href="{:U('Recipients/add')}">添加待支助人</a></li>
				<li><a target="_self" href="{:U('Recipients/pushbyexcel',array('term'=>$term['term_id']))}">Excel导入</a></li
			</ul>
		</div>
		<form name="myform" id="myform" action="#" method="post" class="J_ajaxForms" enctype="multipart/form-data">
			<div class="col-right">
				<div class="table_full">
					<table width="100%">
						<tr>
							<td><b>图相</b></td>
						</tr>
						<tr>
							<td>
								<div  style="text-align: center;"><input type='hidden' name='thumb_ico' id='thumb' value=''>
									<a href='javascript:void(0);' onclick="flashupload('thumb_images', '附件上传', 'thumb', thumb_images, '1,jpg|jpeg|gif|png|bmp,1,,,1', 'content', '12', 'b6ba209759e147124653ac77362ef2bd');
											return false;">
										<img src='__STATIC__/images/icon/upload-pic.png' id='thumb_preview' width='135' height='113' style='cursor:hand' /></a>
									<input type="button" class="btn" onclick="crop_cut_thumb($('#thumb').val());return false;" value="裁减图片"> 
									<input type="button"  class="btn" onclick="$('#thumb_preview').attr('src', '__STATIC__/images/icon/upload-pic.png');
											$('#thumb').val('');
											return false;" value="取消图片">
								</div>
							</td>
						</tr>

					
					</table>
				</div>
			</div>
			<style type="text/css">
				table tr td span{
					width: 50px;display: inline-block;text-align: right;padding-right: 10px;
				}
			</style>
			<div class="col-auto">
				<div class="h_a">文章内容</div>
				<div class="table_full">
		<div  style="border:2px dotted #217ABC;text-align:center;padding-top:10px;padding-bottom:10px;">
			<table class="family" width="100%;">
				<tr id="memberOfFamily">
					<th width="80">个人信息</th>
					<td><span>姓名</span><input type="text" name="name"></td>
						<td><span>性别</span>	
						<select name="sex">
											<option value="1">男</option>
											<option value="2">女</option>
										</select></td>
						<td><span>年级</span>
						<select name="grade" id="">
							<option value="一年级">一年级</option>
							<option value="二年级">二年级</option>
							<option value="三年级">三年级</option>
							<option value="四年级">四年级</option>
							<option value="五年级">五年级</option>
							<option value="六年级">六年级</option>
							<option value="初一">初一</option>
							<option value="初二">初二</option>
							<option value="初三">初三</option>
							<option value="高一">高一</option>
							<option value="高二">高二</option>
							<option value="高三">高三</option>
						</select>
						<td><span>年龄</span><input type="text" name="age"></td>
						<td><span>民族</span>
						<select name="nation" id="">
						<?php foreach ($nation as $key => $v): ?>
							<option value="{$v.id}">{$v.name}</option>
							
						<?php endforeach ?>
						</select>
						<!-- <input type="text"	name = "nation"> -->

						</td>

				</tr>
				
				
			</table>
		</div>
		
					<style type="text/css">
			.family td{
				border-bottom: 1px solid 2px;
			}
			</style>
			<div  style="border:2px dotted #c8c8c8;text-align:center;padding-top:10px;">
				<table class="family memberOfFamily" width="100%;">
					<tr id="memberOfFamily">
						<th width="80">家庭成员</th>
						<td><span>成员关系</span><input type="text" name="relations[]"></td>
						<td><span>名字</span><input type="text" name="names[]"></td>
						<td><span>年龄</span><input type="text" name="ages[]"></td>
						<td><span>职业</span><input type="text" name="vocations[]"></td>
						<td><span>电话</span><input type="text" name="phones[]"></td>
					</tr>

					
				</table>
				<table width="100%">
					<tr><td> <a id="add-family" href="javascript:;" class="btn btn_submit">添加成员关系</a></td></tr>
				</table>

			</div>
			<script type="text/javascript">
			$('#add-family').click(function(event) {
				var str = '<tr id="memberOfFamily">\
						<th width="80">家庭成员</th>\
						<td><span>成员关系</span><input type="text" name="relations[]"></td>\
						<td><span>名字</span><input type="text" name="names[]"></td>\
						<td><span>年龄</span><input type="text" name="ages[]"></td>\
						<td><span>职业</span><input type="text" name="vocations[]"></td>\
						<td><span>电话</span><input type="text" name="phones[]"></td>\
					</tr>';
					$('.memberOfFamily').append(str);
			});
			</script>

		
		<div  style="border:2px dotted #277FC2;text-align:center;padding-top:10px;padding-bottom:10px;">
			<table class="family" width="100%;">
				<tr id="memberOfFamily">
					<th width="80">学校信息</th>
					
					<td>
						<span>班主任</span>
						<select name="class_teacher_name" id="get_teacher_area">
						
							<?php foreach ($teacher as $key => $v): ?>
								<option value="{$v.id}">{$v.name}</option>
							<?php endforeach ?>
						
						</select>

					
						<a href="javascript:;" id="school_name_btn" jsondb="getTeacher" class="ajax-reset">刷新</a >
					</td>
					<td></td>
					<td></td>
					<td></td>


				</tr>
				
			</table>
		</div>

		<div  style="border:2px dotted #c8c8c8;text-align:center;padding-top:10px;padding-bottom:10px;">
			<table class="family" width="100%;">
				<tr id="memberOfFamily">
					<th width="80">捐助信息</th>
					<td><span>需要捐助金额</span><input type="text" name="need_money"></td>
					<td><span>需要开始时间</span><input class="input length_3 J_datetime " type="text" name="start_time" id="start_time"></td>
					<td><span>需要结束时间</span><input class="input length_3 J_datetime " type="text" name="end_time" id="end_time"></td>
				</tr>
				
			</table>
		</div>

		<script>
		    $(function () {
		        $('#start_time').calendar({format: 'yyyy-MM-dd'});
		        $('#end_time').calendar({format: 'yyyy-MM-dd'});
		    })
		</script>





				
					<table width="100%">
					<tr>
							<th width="80">所属种类</th>
							<td>
								<select name="love_type" id="">
								<option value="1">春草行动</option>
								<option value="2">春风行动</option>
								<option value="3">春晖行动</option>

							</select>
							</td>
							
							
						</tr>
						<tr>
							<th width="80">家庭住址</th>
							<td><input type='text' name='family_address'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
							<th width="80">家庭电话</th>
							<td><input type='text' name='family_phone_number'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
						<th width="80">家庭年收入</th>
							<td><input type='text' name='annual_earnings'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
							<th width="80">学校提供的家庭信息 </th>
							<td><textarea name='family_info_by_school' id='description' style='width:98%;height:70px;'></textarea> </td>
						</tr>
						<th width="80">信息确认人</th>
							<td><input type='text' name='check_people'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
							<th width="80">确认人提供的信息</th>
							<td><textarea name='family_info_by_checkpeople' id='description' style='width:98%;height:70px;'></textarea> </td>
						</tr>
						<tr>
							<th width="80">协会捐助意见</th>
							<td><input type="text" name="donor_opinion" value="同意捐助"> </td>
						</tr>
						<tr>
							<th width="80">资料确认时间</th>
							<td><input type="text" name="sign_data_time" class="input length_3 J_datetime "> </td>
						</tr>

						</tbody>
					</table>
				</div>
				<div  style="border:2px dotted #c8c8c8;text-align:center;padding-top:10px;padding-bottom:10px;">
					<table width="100%">
					
						<tr>
							<th width="80">捐助人姓名</th>
							<td><input type='text' name='family_address'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
							<th width="80">捐助人金额</th>
							<td><input type='text' name='family_phone_number'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
						<th width="80">捐助开始时间</th>
							<td><input type='text' name='annual_earnings'   style='width:280px'   class='input' placeholder=''></td>
						</tr>

						<tr>
							<th width="80">电话号码 </th>
							<td><textarea name='family_info_by_school' id='description' style='width:98%;height:70px;'></textarea> </td>
						</tr>
						<th width="80">email</th>
							<td><input type='text' name='check_people'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
							<th width="80">其它备注</th>
							<td><textarea name='family_info_by_checkpeople' id='description' style='width:98%;height:70px;'></textarea> </td>
						</tr>
						</tbody>
					</table>
				</div>
				<div  style="border:2px dotted #c8c8c8;text-align:center;padding-top:10px;padding-bottom:10px;">
					<table width="100%">
					
						<tr>
							<th width="80">到款核实人</th>
							<td><input type='text' name='family_address'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
							<th width="80">到款核实人电话</th>
							<td><input type='text' name='family_address'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
							<th width="80">部门</th>
							<td><input type='text' name='family_phone_number'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
						<th width="80">受捐方式</th>
							<td><input type='text' name='annual_earnings'   style='width:280px'   class='input' placeholder=''></td>
						</tr>
						<tr>
						<th width="80">受捐帐号</th>
							<td><input type='text' name='annual_earnings'   style='width:280px'   class='input' placeholder=''></td>
						</tr>

						
						<tr>
							<th width="80">其它备注</th>
							<td><textarea name='family_info_by_checkpeople' id='description' style='width:98%;height:70px;'></textarea> </td>
						</tr>
					
						

						</tbody>
					</table>
				</div>
			</div>

			<div class="" style="z-index:999;text-align: center;margin-top:20px;">
				<div class="btn_wrap_pd">
					<input value="56" type="hidden" name="id">
					<input type="hidden" name="catid" value="12" />
					<input type="hidden" name="ajax" value="1" />
					<button class="btn btn_submit J_ajax_submit_btn"type="submit">提交</button>
					<button class="btn J_ajax_close_btn"type="submit">关闭</button>
				</div>
			</div>
		</form>
	</div>
</block>

<block name="script">

<script type="text/javascript">
	J_ajax_admin_recipients('.ajax-reset');

	
</script>

	<script type="text/javascript" src="__STATIC__/js/content_addtop.js{$js_debug}"></script>
	<script type="text/javascript">
									//编辑器路径定义
									var editorURL = GV.DIMAUB;
	</script>
	<script type="text/javascript"  src="__STATIC__/js/ueditor/editor_config.js"></script>
	<script type="text/javascript"  src="__STATIC__/js/ueditor/editor_all_min.js"></script>

	<script type="text/javascript">

									var editorcontent;
									UE.commands['attachments'] = {
										execCommand: function(cmd) {
											flashupload('flashupload', '附件上传', 'content', ueAttachment, '10,,1,,,0', 'Contents', '12', 'd909680d11bb7090136c35b9b9d4e66d');
										},
										queryCommandState: function() {
											return this.highlight ? -1 : 0;
										}
									};

									$(function() {
										//setInterval(function(){public_lock_renewal();}, 10000);
										$(".J_ajax_close_btn").on('click', function(e) {
											e.preventDefault();
											Wind.use("artDialog", function() {
												art.dialog({
													id: "question",
													icon: "question",
													fixed: true,
													lock: true,
													background: "#CCCCCC",
													opacity: 0,
													content: "您确定需要关闭当前页面嘛？",
													ok: function() {
														setCookie("refersh_time", 1);
														window.close();
														return true;
													}
												});
											});
										});
										/////---------------------
										Wind.use('validate', 'ajaxForm', 'artDialog', function() {
											//javascript

											//编辑器
											editorcontent = new baidu.editor.ui.Editor();
											editorcontent.render('content');
											try {
												editorcontent.sync();
											} catch (err) {
											}
											;
											//增加编辑器验证规则
											jQuery.validator.addMethod('editorcontent', function() {
												try {
													editorcontent.sync();
												} catch (err) {
												}
												;
												return editorcontent.hasContents();
											});
											var form = $('form.J_ajaxForms');
											//ie处理placeholder提交问题
											if ($.browser.msie) {
												form.find('[placeholder]').each(function() {
													var input = $(this);
													if (input.val() == input.attr('placeholder')) {
														input.val('');
													}
												});
											}
											//表单验证开始
											form.validate({
												//是否在获取焦点时验证
												onfocusout: false,
												//是否在敲击键盘时验证
												onkeyup: false,
												//当鼠标掉级时验证
												onclick: false,
												//验证错误
												showErrors: function(errorMap, errorArr) {
													//errorMap {'name':'错误信息'}
													//errorArr [{'message':'错误信息',element:({})}]
													try {
														$(errorArr[0].element).focus();
														art.dialog({
															id: 'error',
															icon: 'error',
															lock: true,
															fixed: true,
															background: "#CCCCCC",
															opacity: 0,
															content: errorArr[0].message,
															cancelVal: '确定',
															cancel: function() {
																$(errorArr[0].element).focus();
															}
														});
													} catch (err) {
													}
												},
												//验证规则
												rules: {'post[post_title]': {required: 1}, 'post[post_content]': {editorcontent: true}},
												//验证未通过提示消息
												messages: {'post[post_title]': {required: '请输入标题'}, 'post[post_content]': {editorcontent: '内容不能为空'}},
												//给未通过验证的元素加效果,闪烁等
												highlight: false,
												//是否在获取焦点时验证
												onfocusout: false,
														//验证通过，提交表单
														submitHandler: function(forms) {
															$(forms).ajaxSubmit({
																url: form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
																dataType: 'json',
																beforeSubmit: function(arr, $form, options) {

																},
																success: function(data, statusText, xhr, $form) {
																	if (data.status) {
																		setCookie("refersh_time", 1);
																		//添加成功
																		Wind.use("artDialog", function() {
																			art.dialog({
																				id: "succeed",
																				icon: "succeed",
																				fixed: true,
																				lock: true,
																				background: "#CCCCCC",
																				opacity: 0,
																				content: data.info,
																				button: [
																					{
																						name: '继续添加？',
																						callback: function() {
																							reloadPage(window);
																							return true;
																						},
																						focus: true
																					}, {
																						name: '返回列表页',
																						callback: function() {
																							location = '__URL__';
																							return true;
																						}
																					}
																				]
																			});
																		});
																	} else {
																		isalert(data.info);
																	}
																}
															});
														}
											});
										});
										////-------------------------
									});
	</script>	
</block>
